import Mock from 'mockjs';
const MAX_COUNT = 50;

function genPointInfo (cmd) {
  let c = cmd || Mock.mock('@integer(1,3)');
  return Mock.mock({
    "x": '@integer(0,1920)',
    "y": '@integer(0,1080)',
    "color": '@color',
    "lineWidth": '@integer(1,20)',
    "cmd": c,
    "validEnable|1": [0,1,1,1,1,1,1]
  })
} 

const count = parseInt(Math.random() * MAX_COUNT);
let pointList = [genPointInfo(1)];
for(let i = 1;  i<count; i++) {
  if(pointList[pointList.length-1].validEnable) {
    pointList.push(genPointInfo())
  } else {
    pointList.push(genPointInfo(1));
  }
}

const testList = [
  {
    x: 100,
    y: 100,
    color: '#33aeff',
    lineWidth: 8,
    cmd: 2,
    validEnable: 1
  },
  {
    x: 200,
    y: 300,
    color: '#33aeff',
    lineWidth: 8,
    cmd: 2,
    validEnable: 1
  },
  {
    x: 1820,
    y: 980,
    color: '#33aeff',
    lineWidth: 8,
    cmd: 3,
    validEnable: 1
  }
]

export const mockList =  pointList;
// export const mockList =  testList;